﻿-- Define the relationship between MarkCondition and Person
ALTER TABLE [dbo].[MarkCondition] WITH CHECK ADD  
       CONSTRAINT [FK_MarkCondition_CreatedByPerson] FOREIGN KEY([CreatedBy])
REFERENCES [dbo].[Person] ([PersonId])
ON DELETE NO ACTION
GO
-- Define the relationship between MarkCondition and Mark
ALTER TABLE [dbo].[MarkCondition] WITH CHECK ADD  
       CONSTRAINT [FK_MarkCondition_Mark] FOREIGN KEY([Mark])
REFERENCES [dbo].[Mark] ([MarkId])
ON DELETE NO ACTION
GO
-- Define the relationship between MarkCondition and Mark
ALTER TABLE [dbo].[MarkCondition] WITH CHECK ADD  
       CONSTRAINT [FK_MarkCondition_MarkReq] FOREIGN KEY([RequiredMark])
REFERENCES [dbo].[Mark] ([MarkId])
ON DELETE NO ACTION
GO
-- Define the relationship between MarkCondition and Mark
ALTER TABLE [dbo].[MarkCondition] WITH CHECK ADD  
       CONSTRAINT [FK_MarkCondition_ActivityReq] FOREIGN KEY([RequiredActivity])
REFERENCES [dbo].[Activity] ([ActivityId])
ON DELETE NO ACTION
GO
-- Define the relationship between MarkCondition and Person
ALTER TABLE [dbo].[MarkCondition] WITH CHECK ADD  
       CONSTRAINT [FK_MarkCondition_LastChangedBy] FOREIGN KEY([LastChangedBy])
REFERENCES [dbo].[Person] ([PersonId])
ON DELETE NO ACTION
GO